﻿using System;
using System.Windows.Forms;

namespace DemoApp
{
    public partial class Settings : Form
    {
        public Settings()
        {
            InitializeComponent();
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Username = usernameTextBox.Text;
            Properties.Settings.Default.PIN = pinTextBox.Text;
            Properties.Settings.Default.Key = keyTextBox.Text;
            Properties.Settings.Default.Save();

            DialogResult = DialogResult.OK;
            Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            Close();
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            usernameTextBox.Text = Properties.Settings.Default.Username;
            pinTextBox.Text = Properties.Settings.Default.PIN;
            keyTextBox.Text = Properties.Settings.Default.Key;
            usernameTextBox.Focus();
        }
    }
}